﻿// =================================================================== 
// 项目说明
//====================================================================
// liucx @Copy Right 2019
// 文件： CarRepository.cs
// 项目名称：斑马车务
// 创建时间：2019/9/25
// 负责人：liucx
// ===================================================================
using System;
using System.Text;
using System.Collections.Generic;
using YouWei.Infrastructure.Entity;

namespace YouWei.Infrastructure.Repository
{
    /// <summary>
    /// 仓储层
    /// </summary>	
    public class CarRepository : BaseRepository<Car>
    {

        #region 构造

        public CarRepository() : base() { }

        public CarRepository(string connectionString) : base(connectionString) { }

        public CarRepository(DatabaseContext dbContext) : base(dbContext) { }

        #endregion

        /// <summary>
        /// 根据车型ID获取车款列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        public List<Car> GetCarListBySerialId(int SerialID)
        {
            StringBuilder sb = new StringBuilder("SELECT * FROM Car with(nolock) ");
            sb.Append(" WHERE SerialID=@SerialID ORDER BY CarYear DESC");
            return Query(sb.ToString(), new { SerialID = SerialID });
        }
    }
}